<template>
  <!-- 修改基础信息 -->
  <el-dialog
    title="修改基础信息"
    :visible.sync="changeInfo"
    width="50%"
    class="pactDialog"
    :before-close="closePopUp"
  >
    <el-form ref="pactDataFrom" label-width="80px" :model="pactDataFrom" :rules="pactDataRules" :inline="true" label-position="left">
      <el-form-item label="合同编号" prop="roleName" class="widthPadding">
        <el-input v-model="pactDataFrom.contractId" size="medium" disabled />
      </el-form-item>
      <el-form-item label="账套编码" prop="roleKey" class="widthPadding">
        <el-input v-model="pactDataFrom.financialCode" size="medium" disabled/>
      </el-form-item>
      <el-form-item label="门店编码" prop="roleKey" class="widthPadding">
        <el-input v-model="pactDataFrom.storeId" size="medium" disabled/>
      </el-form-item>
      <el-form-item label="公司名称" prop="roleKey" class="widthPadding">
        <el-input v-model="pactDataFrom.companyName" size="medium" disabled/>
      </el-form-item>
      <el-form-item label="门店名称" prop="roleKey" class="widthPadding">
        <el-input v-model="pactDataFrom.storeName" size="medium" disabled/>
      </el-form-item>
      <el-form-item label="出租人名称" prop="roleKey" label-width="100px" class="widthPadding">
        <el-input v-model="pactDataFrom.lessorName" size="medium" placeholder="请输入出租人"/>
      </el-form-item>
      <el-form-item label="资产类别" prop="roleKey" class="widthPadding">
        <el-select v-model="pactDataFrom.assetsType" placeholder="请选择类别">
          <el-option
            v-for="item in pullDown.property"
            :key="item.id"
            :label="item.value"
            size="small"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="合同是否可撤销" label-width="120px" class="widthPadding">
        <el-select v-model="pactDataFrom.iscontractRevoke" placeholder="请选择是否撤销">
          <el-option
            size="small"
            v-for="item in pullDown.isRepeal"
            :key="item.id"
            :label="item.value"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="建筑面积(㎡)" label-width="110px" class="widthPadding">
        <el-input v-model="pactDataFrom.floorage" size="medium" placeholder="请输入建筑面积"/>
      </el-form-item>
      <el-form-item label="租赁资产用途" prop="roleKey" label-width="110px" class="widthPadding">
        <el-select v-model="pactDataFrom.leasePurpose" placeholder="请选择用途">
          <el-option
            size="small"
            v-for="item in pullDown.purpose"
            :key="item.id"
            :label="item.value"
            :value="item.id">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="门店开业日期" label-width="110px" class="widthPadding">
        <div class="block">
          <el-date-picker
            v-model="pactDataFrom.storeOpeningTime"
            type="date"
            size="medium"
            placeholder="选择日期">
          </el-date-picker>
        </div>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="closePopUp">取 消</el-button>
        <el-button type="primary" size="small" @click="pactUserHandler">确 定</el-button>
      </span>
  </el-dialog>
</template>

<script>
export default {
  props: ['changeInfo', 'pactDataFrom'],
  data() {
    return {
      // 验证规则
      pactDataRules: {
        roleKey: [
          { required: true, message: '不能为空', trigger: 'blur' }
        ]
      },
      // 下拉选择数据
      pullDown: {
        // 资产类
        property: [{
          id: 1,
          value: '房屋'
        }, {
          id: 2,
          value: '设备'
        }],
        // 合同是否撤销
        isRepeal: [{
          id: 1,
          value: '是'
        }, {
          id: 2,
          value: '否'
        }],
        // 资产用途
        purpose: [{
          id: 1,
          value: '门店经营'
        }, {
          id: 2,
          value: '办公'
        }, {
          id: 3,
          value: '职工福利'
        }]
      }
    }
  },
  methods: {
    // 关闭弹窗
    closePopUp() {
      this.$emit('colse')
    },
    // 确定提交数据
    pactUserHandler() {
      // 调用父级提交
      this.$emit('pactHandler')
    }
  }
}
</script>

<style scoped>
.widthPadding{
  padding: 0px 30px;
}
</style>
